' Copyright © Microsoft Corporation. All Rights Reserved.
' This code released under the terms of the
| Note: |
|---|
|
This sample runs in Microsoft Office Word 2007 and higher. |
This sample demonstrates how to bind content controls on a Word document to fields in a Microsoft Office Access database. Each content control on the document is bound to a different field in the Northwind sample database. The document also displays an actions pane that you can use to navigate through employee records, search for a specific employee record, and save changes that you make in one of the content controls to the database.
| Security Note: |
|---|
|
This sample code is intended to illustrate a concept, and it shows only the code that is relevant to that concept. It may not meet the security requirements for a specific environment, and it should not be used exactly as shown. We recommend that you add security and error-handling code to make your projects more secure and robust. Microsoft provides this sample code "AS IS" with no warranties. |
For information about how to install the sample project on your computer, see How to: Install and Use Sample Files Found in Help.
To run this sample
-
Press F5.
Verify that the content controls in the table display information about an employee named Nancy Davolio.
-
In the actions pane, click the Next and Previous buttons to view different employee records.
Verify that the content controls display information from the currently selected employee record.
-
In the actions pane, enter a number from 1 through 9 in the Input ID text box, and click the Search by ID button.
Verify that the content controls display information from the employee record that matches the ID.
-
Click in the cell to the right of the Title cell and type a new title for the current employee.
-
In the actions pane, click the Submit change to Title button to save the new title to the database.
-
Open the Northwind.mdb database in Access, and verify that the Title field of the employee has the new title.
Requirements
This sample requires the following applications:
-
Visual Studio Tools for Office.
-
Microsoft Office Word 2007.
-
Microsoft Office Access.
-
The Northwind sample database for Microsoft Office Access (included in the sample).
Demonstrates
This sample demonstrates the following concepts:
-
Binding the following content controls to database fields:
-
PlainTextContentControl
-
PictureContentControl
-
DatePickerContentControl
-
-
Saving data in a data-bound content control to the database (this is also named two-way data binding).
-
Using the actions pane.